<template>
<div style="width: 100%">
  <a-card class="card" :bordered="false">
    <div class="table-page-search-wrapper">
      <a-form layout="vertical">
        <a-row :gutter="48">
          <a-col :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <a-form-item label="校区">
            <a-select :allowClear="true" v-model="queryParam.sznj">
              <a-select-option v-for="i in TYPE0126" :key="i.id" :value="i.code">{{ i.name }}</a-select-option>
            </a-select>
          </a-form-item>
          </a-col>
          <a-col :sm="{span:12}" :lg="{span:12}" :xl="{span:12}">
            <a-button type="primary" @click="handleExport">导出PDF</a-button>
          </a-col>
        </a-row>
      </a-form>
    </div>
    </a-card>
</div>
</template>

<script>
// import moment from 'moment'
import { mapState } from 'vuex'

const selectArr = ['TYPE0126', 'TYPE0075', 'TYPE0125', 'TYPE0072']

export default {
  data () {
    return {
      loading: false,
      data: [],
      // 查询参数
      queryParam: {
        hzfs: 'yx'
      },
      postParams: {},
      // 表头
      columns: [
        {
          title: '序号',
          scopedSlots: { customRender: 'serial' }
        },
        {
          title: '校区',
          dataIndex: 'xq'
        },
        {
          title: '人数',
          dataIndex: 'rs'
        }
      ],
      selectMenu: {
        yx: [] // 院系
      },
      recruitEditData: {}
    }
  },
  computed: {
    ...mapState({
      systemInfo: state => state.app.systemInfo,
      TYPE0126: state => state.app['TYPE0126'] // 年级
    })
  },
  created () {
    this.initSelectMenu()
    this.loadData()
    selectArr.forEach(v => {
      this.$store.dispatch('app/setDictionary', v)
    })
  },
  methods: {
    initSelectMenu () {
      let allRequest = [
        this.$api.base.collegeAll()
      ]
      Promise.all(allRequest).then(res => {
        this.selectMenu = {
          yx: res[0].data
        }
      })
    },
    // 选择院系
    yxChange (code) {
      this.$set(this.queryParam, 'sszym', '')
      this.$api.base.majorAll({lsdwh: code}).then(res => {
        this.$set(this.selectMenu, 'zy', res.data)
      })
    },
    // 加载数据
    loadData () {
      return new Promise(resolve => { resolve() }).then(res => {
        this.data = [{
          xq: '电子院',
          rs: '200',
          key: 1
        }, {
          xq: '检察院',
          rs: '200',
          key: 11
        }, {
          xq: '设计院',
          rs: '200',
          key: 15
        }]
      })
    },
    // 选择招生年度
    zsndChange () {

    },
    // 导出
    handleExport () {
      console.log('导出')
    }
  }
}
</script>

<style lang="less" scoped>
.card{
  margin-bottom: 20px;
}
</style>
